package com.ruoyi.diagmanage.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.analysiswarning.domain.vo.PageVO;
import com.ruoyi.diagmanage.domain.DatabaseReport;
import com.ruoyi.diagmanage.domain.StateInventory;
import com.ruoyi.diagmanage.mapper.DataBaseMapper;
import com.ruoyi.diagmanage.service.DataBaseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class DataBaseServiceImpl implements DataBaseService {

    @Resource
    private DataBaseMapper dataBaseMapper;


    @Override
    public PageVO<List<Map<String, Object>>> queryDatabaseReportList(PageVO<DatabaseReport> databaseReport) {


        PageHelper.startPage(databaseReport.getPageNumber(),databaseReport.getPageSize());

        List<Map<String, Object>> maps = dataBaseMapper.queryDatabaseReportList(databaseReport.getData());

        PageInfo<Map<String, Object>> page = new PageInfo<>(maps);

        PageVO<List<Map<String, Object>>> analyOverviewPageVO = new PageVO<>();

        analyOverviewPageVO.setPageNumber(page.getPageNum()).
                setPageSize(page.getPageSize()).setTotal(page.getTotal()).
                setData(page.getList());

        return analyOverviewPageVO;

    }

    @Override
    public List<Map<String, Object>> queryDatabaseReportList(DatabaseReport databaseReport) {
        return dataBaseMapper.queryDatabaseReportList(databaseReport);
    }


}
